<?php
$id=$_GET['id'];
$info = sel_sql($table, "*", "id=$id");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="../css/style.css" rel="stylesheet" type="text/css">
<style>
.redborder{ border:1px solid #F00}
</style>
<script language="javascript" type="text/javascript" src="../../js/jquery.js"></script>
<script charset="utf-8" src="../../kindeditor/kindeditor.js"></script>
<script>
$(function() {
	var editor = KindEditor.create('#content');
});
</script>
<script language="javascript" type="text/javascript">	
function openwinx(url,name,w,h)
{
    window.open(url,name,"top=100,left=400,width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no");
}

$(function(){
    $('#form1').submit(function(){
		var subm=1;
	    $('.required').each(function(){
		    if($(this).val()==''){
			    $(this).focus().addClass('redborder');
				alert('该字段不能为空');
				subm=0;
				return false;
			}
		});
		if(subm==0) return false;
		if(subm==1) return true;
	});
	$('.required').blur(function(){
	    if($(this).val()!=''){
		    $(this).removeClass('redborder')
		}
	});
});
</script>
<style type="text/css">
<!--
.STYLE1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
.STYLE2 {
	color: #555555;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
-->
</style>
</head>

<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td height="30" colspan="2" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="../images/arrow.gif" width="16" height="22" align="absmiddle" /> 添加新的兑换商品</strong></td>
            </tr>
            <tr>
              <td width="100%" colspan="2" valign="top"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top"><form id="form1" name="form1" method="post" action="admin.php?act=save">
<table width="100%"  align="center" border=1 cellpadding=0 cellspacing=0 style="border-collapse: collapse" bordercolor="#dddddd">
                      
					   <tr>
                        <td width="10%" height="30" align="right" class="bigtext">商品名称：</td>
                        <td width="" height="30">&nbsp;<input id="name" type="text" name="info[name]" class="btn3 required" value="<?=$info['name']?>" style="width:200px;" /></td>
                        <td width="10%" height="30" align="right">&nbsp;商品数量：</td>
					    <td width="60%" height="30">&nbsp;<input name="info[num]" type="text" class="btn3 required" style="width:100px;" value="<?=$info['num']?>" maxlength="3" />
					      &nbsp;</td>
					   </tr>
                       <tr>
                        <td width="96" height="30" align="right" class="bigtext">市场价：</td>
                        <td height="30" class="bigtext">&nbsp;<input name="info[jifen]" type="text" value="<?=$info['jifen']?>" class="btn3 required" style="width:200px;" /></td>
                        <td height="30" class="bigtext" align="right">所需现金：</td>
                        <td height="30" class="bigtext">&nbsp;<input name="info[money]" type="text" value="<?=$info['money']?>" class="btn3 required" style="width:150px;" /></td>
                      <tr>
                        <td width="96" height="30" align="right" class="bigtext">商品图片&nbsp;&nbsp;&nbsp;<br>
                        (160x160)：&nbsp;</td>
                        <td height="30" class="bigtext">&nbsp;<input name="info[pic]" id="pic" type="text" class="required" style="width:190px" value="<?=$info['pic']?>" /><input type="button" value="上传图片" onclick="javascript:openwinx('../upload_pic.php?uploadtext=pic&sid=<?=session_id()?>','upload','450','350')" /></td>
                        <td height="30" class="bigtext" align="right">排序：&nbsp;</td>
                        <td height="30" class="bigtext">&nbsp;<input name="info[sort]" type="text" class="btn3 required" style="width:30px;" value="<?=$info['sort']?$info['sort']:0?>" maxlength="10" />&nbsp;越大越靠前 &nbsp;&nbsp;<input name="info[recommend]" type="checkbox"  id="recommend" value="1" <?php if($info['recommend']){?>checked="checked" <?php }?>/> 首页推荐
                          </td>
                      </tr>
                      
                      <tr>
                        <td height="30" align="right" class="bigtext">介绍：</td>
                        <td height="30" colspan="3"><textarea class=" required" id="content" name="info[content]" style="width:700px;height:300px;visibility:hidden;">
    <?=$info['content']?>
    </textarea></td>
                      </tr>
                      <tr>
                        <td height="30" align="right" class="bigtext">提交：</td>
                        <td height="30" colspan="3"><table width="600" height="30" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;
      <select name="info[hide]">						
						<option value="0" <?php if($info['hide']==0){?> selected="selected" <?php }?>>显示</option>
						<option value="1" <?php if($info['hide']==1){?> selected="selected" <?php }?>>隐藏</option>
						</select> <input type="submit" name="Submit" value=" 添加兑换商品 " />
                        </td>
    </tr>
</table></td><input type="hidden" name="info[id]" value="<?=$info['id']?>"  />
                      </tr>
                    </table>
                  </form>
                  </td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
<?php mysql_close();?>
</body>
</html>